// 接口API

import request from '../axios';

export const findAllCategory = () => {
  return request({
    url: '/home/category/head',
    method: 'get',
    data: '',
  });
};

// 获取轮播图数据
export const findBrand = (limit) => {
  return request({
    url: '/home/brand',
    method: 'get',
    data: {
      limit,
    },
  });
};

/**
 * 获取单个顶级分类信息
 * @param {String} id - 顶级分类ID
 */
export const findTopCategory = (id) => {
  return request({
    url: '/category',
    method: 'get',
    data: {
      id,
    },
  });
};

/**
 * 获取二级分类信息数据
 * @param {String} id - 顶级分类ID
 */

export const findSubCategory = (id) => {
  return request({
    url: '/category/sub/filter',
    method: 'get',
    data: {
      id,
    },
  });
};

export const findSubCategoryGoods = (params) => {
  return request({
    url: '/category/goods/temporary',
    method: 'post',
    data: params,
  });
};
